﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace ClientOverflow.UserControls.Converters
{
    public class InverseCollectionToVisibilityConverter : IValueConverter
    {
        private CollectionToVisibilityConverter basicConverter;

        public InverseCollectionToVisibilityConverter()
        {
            basicConverter = new CollectionToVisibilityConverter();
        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var visibility = (Visibility) basicConverter.Convert(value, targetType, parameter, culture);

            if(visibility == Visibility.Visible)
            {
                return Visibility.Collapsed;
            }

            return Visibility.Visible;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}